import React from 'react'
// ===================================================================== global declare
const { $fn, $http, $Lazy } = window
// ===================================================================== $Lazy
const Modal 				= $Lazy.state(()=>import('@antd/modal'))
const CodeList 				= $Lazy.state(()=>import('@views/_public/board-list'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[]
	}
	submit = {}
	
	open = (uuid) => {
		this.submit = {uuid}
		this.modalRef.open()
		$http.submit(this, 'board/view', { param: {uuid} }).then(res => {
			this.codeListRef.setBoardValue(res)
		})
	}
	render(){
		return (
			<Modal
				title	= '生成布板'
				width 	= '80%'
				height  = '80%'
				onRef	= { ref => this.modalRef = ref }
				isFullScroll
				onOk	= {()=>{
					$http.submit(this, 'board/bind', { param: {uuid:this.submit.uuid} }).then(data => {
						$fn.msg.success('生成布板成功')
						this.modalRef.close()
					})
				}}
			>
				<div className='oh oys scrollbar'>
					<CodeList onRef={ref=>this.codeListRef=ref} />
				</div>
			</Modal>
		)
	}
}

export default Index